'use client'

import { IHeroInfo } from "@/typing/hero";
import React, { useState } from "react";

interface IHeroProviderContext {
  activeHero: Partial<IHeroInfo> | null;
  setActiveHero: React.Dispatch<React.SetStateAction<Partial<IHeroInfo>>>;
}

export const HeroProviderContext = React.createContext<IHeroProviderContext>({
  activeHero: {},
  setActiveHero: () => { },
});

export function HeroProviders({ children }: { children: React.ReactNode }) {
  const [activeHero, setActiveHero] = useState<Partial<IHeroInfo>>({})
  return (
    <HeroProviderContext.Provider value={{
      activeHero: activeHero,
      setActiveHero: setActiveHero,
    }}>
      {children}
    </HeroProviderContext.Provider>
  )
}
